package com.yidu.BusinessParameters.mapper;

import com.yidu.BusinessParameters.entity.SecurityAccruedEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface SecurityAccruedMapper {
    @Select("SELECT * FROM securityAccrued AS a JOIN security AS s ON a.securityId=s.securityId")
    public List<SecurityAccruedEntity> securityAccruedSelect();
    @Select("SELECT * FROM securityAccrued AS a JOIN security AS s ON a.securityId=s.securityId where 1=1 ${moneyAllocate} order by securityDate limit #{page},#{limit}")
    public List<SecurityAccruedEntity> securityAccruedSelects(Map map);
    @Insert("insert into securityAccrued values(#{securityAccruedId},#{fundId},#{cashId},#{securityDate},#{securityId},#{money},#{moneyFlow},#{businessType})")
    public int securityAccruedinsert(SecurityAccruedEntity securityAccruedEntity);
    @Delete("delete from securityAccrued where securityAccruedId=#{securityAccruedId}")
    public int securityAccrueddelete(String securityAccruedId);
    @Update("update securityAccrued set fundId=#{fundId},cashId=#{cashId},securityDate=#{securityDate},securityId=#{securityId},money=#{money},moneyFlow=#{moneyFlow},businessType=#{businessType} where securityAccruedId=#{securityAccruedId}")
    public int securityAccruedupdate(SecurityAccruedEntity securityAccruedEntity);
    @Update("delete from securityAccrued where securityDate=#{securityDate} and fundId=#{fundId} and businessType=#{businessType} and moneyFlow=#{moneyFlow} ")
    public int deleteSecurities(SecurityAccruedEntity securityAccruedEntity);
    @Select("SELECT count(*) FROM securityAccrued AS a JOIN security AS s ON a.securityId=s.securityId")
    int two();
}
